package com.jspx.txweb.view;

import com.jspx.boot.environment.Environment;
import com.jspx.txweb.annotation.HttpMethod;
import com.jspx.txweb.support.ValidatorAction;
import com.jspx.utils.StringUtil;

/**
 * Created by yuan on 2015/4/1 0001.
 *
 */
@HttpMethod(caption="配置方式数据验证")
public class ValidatorView extends ValidatorAction {

    public String execute() throws Exception
    {
        String url = request.getRequestURI();
        if (StringUtil.countMatches(url, "/")<2)
        {
            printError("验证配置不能找到",  500);
            return NONE;
        }

        url = StringUtil.substringAfter(url, "/");
        url = StringUtil.substringBetween(StringUtil.substringAfter(url,"/"), "/", "."+getEnv(Environment.filterSuffix));
        super.setFormId(url);
        return super.execute();
    }
}
